package com.lanchetech.dao;

import com.lanchetech.bean.request.PageReq;
import com.lanchetech.bean.vo.CustomerServiceVO;
import com.lanchetech.entity.MsgUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MsgUserMapper {
    int deleteByPrimaryKey(Long id);

    int insert(MsgUser record);

    int insertSelective(MsgUser record);

    MsgUser selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(MsgUser record);

    int updateByPrimaryKey(MsgUser record);

    int insert2(MsgUser record);

    MsgUser findOneByRelateIdAndRole(@Param("relateId") Long relateId, @Param("role") Byte role);

    MsgUser findOneByUsername(@Param("username") String username);

    List<MsgUser> findAllByIds(@Param("ids") List<Long> ids);

    List<MsgUser> findAllPage(PageReq req);

    List<MsgUser> findAllByTenantIdAndStatusAndDeleted(@Param("tenantId")Long tenantId,@Param("status")Byte status,@Param("deleted")Byte deleted);

    List<MsgUser> findAllByRoleAndStatusAndDeleted(@Param("role")Byte role,@Param("status")Byte status,@Param("deleted")Byte deleted);

    int updateAvatarByRelateIdAndRole(@Param("updatedAvatar")String updatedAvatar,@Param("relateId")Long relateId,@Param("role")Byte role);

	int updateNicknameByRelateIdAndRole(@Param("updatedNickname")String updatedNickname,@Param("relateId")Long relateId,@Param("role")Byte role);

    int updateTenantIdByRelateIdAndRole(@Param("updatedTenantId")Long updatedTenantId,@Param("relateId")Long relateId,@Param("role")Byte role);

    List<MsgUser> findAllByTenantIdAndRole(@Param("tenantId")Long tenantId,@Param("role")Byte role);

    Long findOneIdByUsername(@Param("username")String username);

    MsgUser findOneByRelateId(@Param("relateId")Long relateId);


    List<CustomerServiceVO> getTenantCustomerService(Long tenantId);

    MsgUser findOneByRelateIdAndRoleAndDeleted(@Param("relateId")Long relateId,@Param("role")Byte role,@Param("deleted")Byte deleted);


}